package com.ng.finance.api.entity;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableLogic;
import com.baomidou.mybatisplus.enums.FieldFill;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 *
 * </p>
 *
 * @author 83673
 * @since 2018-09-13
 */
public class WechatUser extends Model<com.ng.finance.api.entity.WechatUser> {

    public static final String ID = "id";
    public static final String USER_PHONE = "user_phone";
    public static final String USER_NAME = "user_name";
    public static final String OPENID = "openid";
    public static final String UINIONID = "unionid";
    public static final String WECHAT_PIC = "wechat_pic";
    public static final String WECHAT_NICK = "wechat_nick";
    public static final String DEL_FLAG = "del_flag";
    public static final String CREATE_TIME = "create_time";
    public static final String ROLE = "role";
    private static final long serialVersionUID = 1L;
    private Long id;
    /**
     * 用户手机号
     */
    @NotNull(message = "用户手机号码不能为空！")
    @Pattern(regexp = "(\\+\\d+)?(\\d{3,4}\\-?)?\\d{7,8}$", message = "手机号码格式不正确！")
    private String userPhone;
    /**
     * 用户姓名
     */
    @NotBlank(message = "用户姓名不能为空!")
    private String userName;
    /**
     * 用户唯一标识
     */
    private String openid;
    /**
     * 用户在开放平台的唯一标识符，在满足 UnionID 下发条件的情况下会返回
     */
    /**
     * 用户姓名
     */

    private String unionid;
    /**
     * 微信头像
     */

    private String wechatPic;
    /**
     * 微信昵称
     */
    private String wechatNick;
    @TableLogic
    private Integer delFlag;
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    private Integer role;

    public WechatUser(String unionid) {
        this.unionid = unionid;
    }

    public WechatUser() {

    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUserPhone() {
        return userPhone;
    }

    public void setUserPhone(String userPhone) {
        this.userPhone = userPhone;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }

    public String getUnionid() {
        return unionid;
    }

    public void setUnionid(String unionid) {
        this.unionid = unionid;
    }

    public String getWechatPic() {
        return wechatPic;
    }

    public void setWechatPic(String wechatPic) {
        this.wechatPic = wechatPic;
    }

    public String getWechatNick() {
        return wechatNick;
    }

    public void setWechatNick(String wechatNick) {
        this.wechatNick = wechatNick;
    }

    public Integer getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(Integer delFlag) {
        this.delFlag = delFlag;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Integer getRole() {
        return role;
    }

    public void setRole(Integer role) {
        this.role = role;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "WechatUser{" +
                "id=" + id +
                ", userPhone=" + userPhone +
                ", userName=" + userName +
                ", openid=" + openid +
                ", unionid=" + unionid +
                ", wechatPic=" + wechatPic +
                ", wechatNick=" + wechatNick +
                ", delFlag=" + delFlag +
                ", createTime=" + createTime +
                ", role=" + role +
                "}";
    }
}
